<div class="properties-rows">
	<div class="row"><?php foreach ($listings as $listing) { ?> <?php 
		//get media for listing
		$media = $this->mdl_listingmapmodel->get_media($listing['Listing_ID'], "Cover", 1);
		
		?>
		<div class="property span9">
			<div class="row">
			<div class="image span3">
			<div class="content"><a href="detail.html?id=<?php echo $listing['Listing_ID']; ?>"></a> 
				<?php if(isset($media->FileName) && isset($media->FileExtension)) { ?>
				<img src="<?php echo $this->config->item('HTTP_LISTING_MEDIA_IMAGE') . $listing['Listing_ID'] . '/' . $media->FileName . '-270x200' . $media->FileExtension; ?>" alt=""> 
				<?php } else { ?> <img src="<?php echo $this->config->item('HTTP_IMAGE'); ?>tmp/no-image.png" alt=""> <?php } ?>
			</div>
			<!-- /.content --></div>
			<!-- /.image -->
			
			<div class="body span6">
				<div class="title-price row">
					<div class="title span4">
					<h2><a href="detail.html?id=<?php echo $listing['Listing_ID']; ?>"><?php echo $listing['ProjectName']; ?></a></h2>
					</div>
					<!-- /.title -->
					<div class="price"><?php if($listing['Price_Min'] > 0) { ?> <?php echo $listing['PriceUnit'] . " " . number_format(($listing['Price_Min']), 0, '.', ','); ?>
					<?php } else { ?> <?php echo "Price On Application"; ?> <?php } ?>
					</div>
					<!-- /.price -->
				</div>
				<!-- /.title -->
			
				<div class="location"><?php
				//Locality
				//initiation
				$locality = "";
				//check subarea
				if (!empty($listing['Subarea'])) {
					$locality .= $listing['Subarea'] . ", ";
				}
				
				//check location
				if (!empty($listing['Location'])) {
					$locality .= $listing['Location'] . ", ";
				}
				
				//check city
				if (!empty($listing['City'])) {
					$locality .= $listing['City'];
				}
				
				if (!empty($locality)) {
					echo $locality;
				}
				?></div>
				<!-- /.location -->
				<div class="description">
				<p><?php echo html_entity_decode(character_limiter($listing['Description'], 160) , ENT_QUOTES, 'UTF-8'); ?></p>
				</div>
				<div class="pull-left">
				<div class="area sepH_b"><span class="key">Area:</span><!-- /.key --> <span
					class="value"><?php echo number_format($listing['Size_Min']) . ' ' . $listing['SizeUnit']; ?></span><!-- /.value -->
				</div>
				<!-- /.area -->
				<div class="bedrooms">
				<div class="content"><?php echo $listing['Bedroom']; ?></div>
				</div>
				<!-- /.bedrooms -->
				<div class="bathrooms">
				<div class="content"><?php echo $listing['Bathroom']; ?></div>
				</div>
				<!-- /.bathrooms -->
				</div>
				<div class="pull-right morelinks">
				<button class="btn btn-primary contact_agent">Contact Agent</button>
				<button class="btn btn-primary view_detail">View Detail</button>
				<button class="btn btn-primary short_list">Short List</button>
				<input type="hidden" value="<?php echo $listing['Listing_ID']; ?>"
					name="morelinks" id="morelinks"></div>
			</div>
			<!-- /.body --></div>
		<!-- /.property -->
		</div>
		<!-- /.row --> <?php } ?>
	</div>
<!-- /.row -->
</div>
<!-- /.properties-rows -->
